package com.citycloud.ccuap.tc.admin.clientresourceinterfacerel;

import com.citycloud.ccuap.commons.db.SqlRestrictions;
import com.citycloud.ccuap.framework.mybatis.pagination.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import java.util.Map;

@Mapper
public interface ClientResourceInterfaceRelMapper {
    @SelectProvider(
            type = ClientResourceInterfaceRelMapper.RepositoryProvider.class,
            method = "queryAll"
    )
    List<Map<String, Object>> queryAll(String resourceId);

    public static class RepositoryProvider {
        public RepositoryProvider() {
        }
        public String queryAll(String resourceId) {
            StringBuilder sql = new StringBuilder();
            sql.append(" SELECT scrir.interface_id interfaceId, sai.interface_name interfaceName FROM sys_client_resource_interface_rel scrir LEFT JOIN sys_admin_interface sai ON scrir.interface_id = sai.interface_id WHERE 1=1 ")
                .append(SqlRestrictions.eq("scrir.resource_id",resourceId));
            return sql.toString();
        }
    }


}
